POV-Ray : Newsgroups : povray.beta-test : crash with "recursion" in functions : crash with "recursion" in functions Server Time
29 Jul 2024 20:24:49 EDT (-0400)
  crash with "recursion" in functions  
From:
Date: 4 Mar 2002 05:48:40
Message: <uoj68uk5m391emvphovqfbg5vl0en7h2q6@4ax.com>
POV 3.5 b 11 icl on WinNT Sp 6 PII 233 with 128 MB

Following script causes crash in POV-Ray 3.5 b 11.

Two notes:
1) When I remove "u0,v0," from parameters and calls (becouse it's not used at
all in posted example) then this not crash.
2) When I replace "Pattern(u1,v1,0)" with "u1+v1" in Sub[0] assigment then
this not crash.

Could it be becouse all entries of array of functions have to have the same
number of parameters ?

Any confirmation ?

// START
#local Level=6;
#local Dist=1/(2^Level-1);
#local Pattern=function{pattern{agate}}
#local Sub=array[Level];
#local Sub[0]=function(u0,v0,u1,v1){Pattern(u1,v1,0)};
#local Sub[1]=function(u0,v0,u1,v1,u2,v2){
  min(
    Sub[0](u0,v0,u1,v1),
    Sub[0](u0,v0,u1,v2),
    Sub[0](u0,v0,u2,v1),
    Sub[0](u0,v0,u2,v2)
  )
};
#local C=2;
#while (C<Level)
  #local Sub[C]=function(u0,v0,u1,v1,u2,v2){
    min(
      Sub[C-1](
        u0,v0,
        u1,v1,
        (u1+u2)/2-Dist,(v1+v2)/2-Dist
      ),
      Sub[C-1](
        u0,v0,
        u1,(v1+v2)/2+Dist,
        (u1+u2)/2-Dist,v2
      ),
      Sub[C-1](
        u0,v0,
        (u1+u2)/2+Dist,v1,
        u2,(v1+v2)/2-Dist
      ),
      Sub[C-1](
        u0,v0,
        (u1+u2)/2+Dist,(v1+v2)/2+Dist,
        u2,v2
      )
    )
  };
  #local C=C+1;
#end
#local F=function{Sub[Level-1](x,y,x-1,y-1,x+1,y+1)};
plane{
  z 0
  pigment{function{F(x,y,z)}}
  translate z*4
  finish{ambient 1}
}
// END

ABX


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.